<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>Module</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/github.css" type="text/css" media="screen" />
<script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>     
    <div class="banner">
        
            <span>Ruby on Rails v4.0.0</span><br />
        
        <h1>
            <span class="type">Class</span> 
            Module 
            
                <span class="parent">&lt; 
                    
                    <a href="Object.html">Object</a>
                    
                </span>
            
        </h1>
        <ul class="files">
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/module/aliasing_rb.html">activesupport/lib/active_support/core_ext/module/aliasing.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/module/anonymous_rb.html">activesupport/lib/active_support/core_ext/module/anonymous.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/module/attr_internal_rb.html">activesupport/lib/active_support/core_ext/module/attr_internal.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/module/attribute_accessors_rb.html">activesupport/lib/active_support/core_ext/module/attribute_accessors.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/module/delegation_rb.html">activesupport/lib/active_support/core_ext/module/delegation.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/module/deprecation_rb.html">activesupport/lib/active_support/core_ext/module/deprecation.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/module/introspection_rb.html">activesupport/lib/active_support/core_ext/module/introspection.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/module/qualified_const_rb.html">activesupport/lib/active_support/core_ext/module/qualified_const.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/module/reachable_rb.html">activesupport/lib/active_support/core_ext/module/reachable.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/module/remove_method_rb.html">activesupport/lib/active_support/core_ext/module/remove_method.rb</a></li>
            
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
  
    <div class="description">
      
<p>Extends the API for constants to be able to deal with qualified names.
Arguments are assumed to be relative to the receiver.</p>

    </div>
  


  


  
  


  


  
    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
      
        <dt>A</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Module.html#method-i-alias_attribute">alias_attribute</a>,
              </li>
            
              
              <li>
                <a href="Module.html#method-i-alias_method_chain">alias_method_chain</a>,
              </li>
            
              
              <li>
                <a href="Module.html#method-i-anonymous-3F">anonymous?</a>,
              </li>
            
              
              <li>
                <a href="Module.html#method-i-attr_internal">attr_internal</a>,
              </li>
            
              
              <li>
                <a href="Module.html#method-i-attr_internal_accessor">attr_internal_accessor</a>,
              </li>
            
              
              <li>
                <a href="Module.html#method-i-attr_internal_reader">attr_internal_reader</a>,
              </li>
            
              
              <li>
                <a href="Module.html#method-i-attr_internal_writer">attr_internal_writer</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>D</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Module.html#method-i-delegate">delegate</a>,
              </li>
            
              
              <li>
                <a href="Module.html#method-i-deprecate">deprecate</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>L</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Module.html#method-i-local_constant_names">local_constant_names</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>M</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Module.html#method-i-mattr_accessor">mattr_accessor</a>,
              </li>
            
              
              <li>
                <a href="Module.html#method-i-mattr_reader">mattr_reader</a>,
              </li>
            
              
              <li>
                <a href="Module.html#method-i-mattr_writer">mattr_writer</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>P</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Module.html#method-i-parent">parent</a>,
              </li>
            
              
              <li>
                <a href="Module.html#method-i-parent_name">parent_name</a>,
              </li>
            
              
              <li>
                <a href="Module.html#method-i-parents">parents</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>Q</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Module.html#method-i-qualified_const_defined-3F">qualified_const_defined?</a>,
              </li>
            
              
              <li>
                <a href="Module.html#method-i-qualified_const_get">qualified_const_get</a>,
              </li>
            
              
              <li>
                <a href="Module.html#method-i-qualified_const_set">qualified_const_set</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>R</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Module.html#method-i-redefine_method">redefine_method</a>,
              </li>
            
              
              <li>
                <a href="Module.html#method-i-remove_possible_method">remove_possible_method</a>
              </li>
            
          </ul>
        </dd>
      
    </dl>
  

  



  

    

    

    


    
      <!-- Section attributes -->
      <div class="sectiontitle">Attributes</div>
      <table border='0' cellpadding='5'>
        
          <tr valign='top'>
            <td class='attr-rw'>
              [RW]
            </td>
            <td class='attr-name'>attr_internal_naming_format</td>
            <td class='attr-desc'></td>
          </tr>
        
      </table>
    


    <!-- Methods -->
        
      <div class="sectiontitle">Instance Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-i-alias_attribute">
            
              <b>alias_attribute</b>(new_name, old_name)
            
            <a href="Module.html#method-i-alias_attribute" name="method-i-alias_attribute" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Allows you to make aliases for attributes, which includes getter, setter,
and query methods.</p>

<pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">Content</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>
  <span class="ruby-comment"># has a title attribute</span>
<span class="ruby-keyword">end</span>

<span class="ruby-keyword">class</span> <span class="ruby-constant">Email</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">Content</span>
  <span class="ruby-identifier">alias_attribute</span> :<span class="ruby-identifier">subject</span>, :<span class="ruby-identifier">title</span>
<span class="ruby-keyword">end</span>

<span class="ruby-identifier">e</span> = <span class="ruby-constant">Email</span>.<span class="ruby-identifier">find</span>(<span class="ruby-value">1</span>)
<span class="ruby-identifier">e</span>.<span class="ruby-identifier">title</span>    <span class="ruby-comment"># =&gt; &quot;Superstars&quot;</span>
<span class="ruby-identifier">e</span>.<span class="ruby-identifier">subject</span>  <span class="ruby-comment"># =&gt; &quot;Superstars&quot;</span>
<span class="ruby-identifier">e</span>.<span class="ruby-identifier">subject?</span> <span class="ruby-comment"># =&gt; true</span>
<span class="ruby-identifier">e</span>.<span class="ruby-identifier">subject</span> = <span class="ruby-string">&quot;Megastars&quot;</span>
<span class="ruby-identifier">e</span>.<span class="ruby-identifier">title</span>    <span class="ruby-comment"># =&gt; &quot;Megastars&quot;</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-alias_attribute_source')" id="l_method-i-alias_attribute_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fa03e37d31d7c69c90d41f0764c374318d8dced0/activesupport/lib/active_support/core_ext/module/aliasing.rb#L62" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-alias_attribute_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/module/aliasing.rb, line 62</span>
  <span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">alias_attribute</span>(<span class="ruby-identifier">new_name</span>, <span class="ruby-identifier">old_name</span>)
    <span class="ruby-identifier">module_eval</span> <span class="ruby-string">&quot;      def #{new_name}; self.#{old_name}; end          # def subject; self.title; end
      def #{new_name}?; self.#{old_name}?; end        # def subject?; self.title?; end
      def #{new_name}=(v); self.#{old_name} = v; end  # def subject=(v); self.title = v; end
&quot;</span>, <span class="ruby-keyword">__FILE__</span>, <span class="ruby-keyword">__LINE__</span> <span class="ruby-operator">+</span> <span class="ruby-number">1</span>
  <span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-alias_method_chain">
            
              <b>alias_method_chain</b>(target, feature)
            
            <a href="Module.html#method-i-alias_method_chain" name="method-i-alias_method_chain" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Encapsulates the common pattern of:</p>

<pre>alias_method :foo_without_feature, :foo
alias_method :foo, :foo_with_feature</pre>

<p>With this, you simply do:</p>

<pre>alias_method_chain :foo, :feature</pre>

<p>And both aliases are set up for you.</p>

<p>Query and bang methods (foo?, foo!) keep the same punctuation:</p>

<pre>alias_method_chain :foo?, :feature</pre>

<p>is equivalent to</p>

<pre>alias_method :foo_without_feature?, :foo?
alias_method :foo?, :foo_with_feature?</pre>

<p>so you can safely chain foo, foo?, and foo! with the same feature.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-alias_method_chain_source')" id="l_method-i-alias_method_chain_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fa03e37d31d7c69c90d41f0764c374318d8dced0/activesupport/lib/active_support/core_ext/module/aliasing.rb#L23" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-alias_method_chain_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/module/aliasing.rb, line 23</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">alias_method_chain</span>(<span class="ruby-identifier">target</span>, <span class="ruby-identifier">feature</span>)
  <span class="ruby-comment"># Strip out punctuation on predicates or bang methods since</span>
  <span class="ruby-comment"># e.g. target?_without_feature is not a valid method name.</span>
  <span class="ruby-identifier">aliased_target</span>, <span class="ruby-identifier">punctuation</span> = <span class="ruby-identifier">target</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/([?!=])$/</span>, <span class="ruby-string">''</span>), <span class="ruby-node">$1</span>
  <span class="ruby-keyword">yield</span>(<span class="ruby-identifier">aliased_target</span>, <span class="ruby-identifier">punctuation</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_given?</span>

  <span class="ruby-identifier">with_method</span> = <span class="ruby-node">&quot;#{aliased_target}_with_#{feature}#{punctuation}&quot;</span>
  <span class="ruby-identifier">without_method</span> = <span class="ruby-node">&quot;#{aliased_target}_without_#{feature}#{punctuation}&quot;</span>

  <span class="ruby-identifier">alias_method</span> <span class="ruby-identifier">without_method</span>, <span class="ruby-identifier">target</span>
  <span class="ruby-identifier">alias_method</span> <span class="ruby-identifier">target</span>, <span class="ruby-identifier">with_method</span>

  <span class="ruby-keyword">case</span>
  <span class="ruby-keyword">when</span> <span class="ruby-identifier">public_method_defined?</span>(<span class="ruby-identifier">without_method</span>)
    <span class="ruby-identifier">public</span> <span class="ruby-identifier">target</span>
  <span class="ruby-keyword">when</span> <span class="ruby-identifier">protected_method_defined?</span>(<span class="ruby-identifier">without_method</span>)
    <span class="ruby-identifier">protected</span> <span class="ruby-identifier">target</span>
  <span class="ruby-keyword">when</span> <span class="ruby-identifier">private_method_defined?</span>(<span class="ruby-identifier">without_method</span>)
    <span class="ruby-identifier">private</span> <span class="ruby-identifier">target</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-anonymous-3F">
            
              <b>anonymous?</b>()
            
            <a href="Module.html#method-i-anonymous-3F" name="method-i-anonymous-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>A module may or may not have a name.</p>

<pre class="ruby"><span class="ruby-keyword">module</span> <span class="ruby-constant">M</span>; <span class="ruby-keyword">end</span>
<span class="ruby-constant">M</span>.<span class="ruby-identifier">name</span> <span class="ruby-comment"># =&gt; &quot;M&quot;</span>

<span class="ruby-identifier">m</span> = <span class="ruby-constant">Module</span>.<span class="ruby-identifier">new</span>
<span class="ruby-identifier">m</span>.<span class="ruby-identifier">name</span> <span class="ruby-comment"># =&gt; nil</span>
</pre>

<p>A module gets a name when it is first assigned to a constant. Either via
the <code>module</code> or <code>class</code> keyword or by an explicit
assignment:</p>

<pre class="ruby"><span class="ruby-identifier">m</span> = <span class="ruby-constant">Module</span>.<span class="ruby-identifier">new</span> <span class="ruby-comment"># creates an anonymous module</span>
<span class="ruby-constant">M</span> = <span class="ruby-identifier">m</span>          <span class="ruby-comment"># =&gt; m gets a name here as a side-effect</span>
<span class="ruby-identifier">m</span>.<span class="ruby-identifier">name</span>         <span class="ruby-comment"># =&gt; &quot;M&quot;</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-anonymous-3F_source')" id="l_method-i-anonymous-3F_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/794a70f94485fb64ed1c49ba8532895306e2001c/activesupport/lib/active_support/core_ext/module/anonymous.rb#L16" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-anonymous-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/module/anonymous.rb, line 16</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">anonymous?</span>
  <span class="ruby-identifier">name</span>.<span class="ruby-identifier">nil?</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-attr_internal">
            
              <b>attr_internal</b>(*attrs)
            
            <a href="Module.html#method-i-attr_internal" name="method-i-attr_internal" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-attr_internal_accessor">
            
              <b>attr_internal_accessor</b>(*attrs)
            
            <a href="Module.html#method-i-attr_internal_accessor" name="method-i-attr_internal_accessor" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Declares an attribute reader and writer backed by an internally-named
instance variable.</p>
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="Module.html#method-i-attr_internal">attr_internal</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-attr_internal_accessor_source')" id="l_method-i-attr_internal_accessor_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/92572241e2966529360106aec086373d56904dbc/activesupport/lib/active_support/core_ext/module/attr_internal.rb#L14" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-attr_internal_accessor_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/module/attr_internal.rb, line 14</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">attr_internal_accessor</span>(*<span class="ruby-identifier">attrs</span>)
  <span class="ruby-identifier">attr_internal_reader</span>(*<span class="ruby-identifier">attrs</span>)
  <span class="ruby-identifier">attr_internal_writer</span>(*<span class="ruby-identifier">attrs</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-attr_internal_reader">
            
              <b>attr_internal_reader</b>(*attrs)
            
            <a href="Module.html#method-i-attr_internal_reader" name="method-i-attr_internal_reader" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Declares an attribute reader backed by an internally-named instance
variable.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-attr_internal_reader_source')" id="l_method-i-attr_internal_reader_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/92572241e2966529360106aec086373d56904dbc/activesupport/lib/active_support/core_ext/module/attr_internal.rb#L3" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-attr_internal_reader_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/module/attr_internal.rb, line 3</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">attr_internal_reader</span>(*<span class="ruby-identifier">attrs</span>)
  <span class="ruby-identifier">attrs</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">attr_name</span><span class="ruby-operator">|</span> <span class="ruby-identifier">attr_internal_define</span>(<span class="ruby-identifier">attr_name</span>, <span class="ruby-value">:reader</span>)}
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-attr_internal_writer">
            
              <b>attr_internal_writer</b>(*attrs)
            
            <a href="Module.html#method-i-attr_internal_writer" name="method-i-attr_internal_writer" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Declares an attribute writer backed by an internally-named instance
variable.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-attr_internal_writer_source')" id="l_method-i-attr_internal_writer_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/92572241e2966529360106aec086373d56904dbc/activesupport/lib/active_support/core_ext/module/attr_internal.rb#L8" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-attr_internal_writer_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/module/attr_internal.rb, line 8</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">attr_internal_writer</span>(*<span class="ruby-identifier">attrs</span>)
  <span class="ruby-identifier">attrs</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">attr_name</span><span class="ruby-operator">|</span> <span class="ruby-identifier">attr_internal_define</span>(<span class="ruby-identifier">attr_name</span>, <span class="ruby-value">:writer</span>)}
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-delegate">
            
              <b>delegate</b>(*methods)
            
            <a href="Module.html#method-i-delegate" name="method-i-delegate" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Provides a <code>delegate</code> class method to easily expose contained
objects’ public methods as your own.</p>

<p>The macro receives one or more method names (specified as symbols or
strings) and the name of the target object via the <code>:to</code> option
(also a symbol or string).</p>

<p>Delegation is particularly useful with Active Record associations:</p>

<pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">Greeter</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">hello</span>
    <span class="ruby-string">'hello'</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">def</span> <span class="ruby-identifier">goodbye</span>
    <span class="ruby-string">'goodbye'</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>

<span class="ruby-keyword">class</span> <span class="ruby-constant">Foo</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>
  <span class="ruby-identifier">belongs_to</span> :<span class="ruby-identifier">greeter</span>
  <span class="ruby-identifier">delegate</span> :<span class="ruby-identifier">hello</span>, <span class="ruby-identifier">to</span><span class="ruby-operator">:</span> :<span class="ruby-identifier">greeter</span>
<span class="ruby-keyword">end</span>

<span class="ruby-constant">Foo</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">hello</span>   <span class="ruby-comment"># =&gt; &quot;hello&quot;</span>
<span class="ruby-constant">Foo</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">goodbye</span> <span class="ruby-comment"># =&gt; NoMethodError: undefined method `goodbye' for #&lt;Foo:0x1af30c&gt;</span>
</pre>

<p>Multiple delegates to the same target are allowed:</p>

<pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">Foo</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>
  <span class="ruby-identifier">belongs_to</span> :<span class="ruby-identifier">greeter</span>
  <span class="ruby-identifier">delegate</span> :<span class="ruby-identifier">hello</span>, :<span class="ruby-identifier">goodbye</span>, <span class="ruby-identifier">to</span><span class="ruby-operator">:</span> :<span class="ruby-identifier">greeter</span>
<span class="ruby-keyword">end</span>

<span class="ruby-constant">Foo</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">goodbye</span> <span class="ruby-comment"># =&gt; &quot;goodbye&quot;</span>
</pre>

<p>Methods can be delegated to instance variables, class variables, or
constants by providing them as a symbols:</p>

<pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">Foo</span>
  <span class="ruby-constant">CONSTANT_ARRAY</span> = [<span class="ruby-value">0</span>,<span class="ruby-value">1</span>,<span class="ruby-value">2</span>,<span class="ruby-value">3</span>]
  <span class="ruby-identifier">@@class_array</span>  = [<span class="ruby-value">4</span>,<span class="ruby-value">5</span>,<span class="ruby-value">6</span>,<span class="ruby-value">7</span>]

  <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>
    <span class="ruby-ivar">@instance_array</span> = [<span class="ruby-value">8</span>,<span class="ruby-value">9</span>,<span class="ruby-value">10</span>,<span class="ruby-value">11</span>]
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">delegate</span> :<span class="ruby-identifier">sum</span>, <span class="ruby-identifier">to</span><span class="ruby-operator">:</span> :<span class="ruby-constant">CONSTANT_ARRAY</span>
  <span class="ruby-identifier">delegate</span> :<span class="ruby-identifier">min</span>, <span class="ruby-identifier">to</span><span class="ruby-operator">:</span> :<span class="ruby-identifier">@@class_array</span>
  <span class="ruby-identifier">delegate</span> :<span class="ruby-identifier">max</span>, <span class="ruby-identifier">to</span><span class="ruby-operator">:</span> :<span class="ruby-ivar">@instance_array</span>
<span class="ruby-keyword">end</span>

<span class="ruby-constant">Foo</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">sum</span> <span class="ruby-comment"># =&gt; 6</span>
<span class="ruby-constant">Foo</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">min</span> <span class="ruby-comment"># =&gt; 4</span>
<span class="ruby-constant">Foo</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">max</span> <span class="ruby-comment"># =&gt; 11</span>
</pre>

<p>It’s also possible to delegate a method to the class by using
<code>:class</code>:</p>

<pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">Foo</span>
  <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">hello</span>
    <span class="ruby-string">&quot;world&quot;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">delegate</span> :<span class="ruby-identifier">hello</span>, <span class="ruby-identifier">to</span><span class="ruby-operator">:</span> :<span class="ruby-keyword">class</span>
<span class="ruby-keyword">end</span>

<span class="ruby-constant">Foo</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">hello</span> <span class="ruby-comment"># =&gt; &quot;world&quot;</span>
</pre>

<p>Delegates can optionally be prefixed using the <code>:prefix</code> option.
If the value is <code>true</code>, the delegate methods are prefixed with
the name of the object being delegated to.</p>

<pre class="ruby"><span class="ruby-constant">Person</span> = <span class="ruby-constant">Struct</span>.<span class="ruby-identifier">new</span>(:<span class="ruby-identifier">name</span>, :<span class="ruby-identifier">address</span>)

<span class="ruby-keyword">class</span> <span class="ruby-constant">Invoice</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">Struct</span>.<span class="ruby-identifier">new</span>(:<span class="ruby-identifier">client</span>)
  <span class="ruby-identifier">delegate</span> :<span class="ruby-identifier">name</span>, :<span class="ruby-identifier">address</span>, <span class="ruby-identifier">to</span><span class="ruby-operator">:</span> :<span class="ruby-identifier">client</span>, <span class="ruby-identifier">prefix</span><span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span>

<span class="ruby-identifier">john_doe</span> = <span class="ruby-constant">Person</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">'John Doe'</span>, <span class="ruby-string">'Vimmersvej 13'</span>)
<span class="ruby-identifier">invoice</span> = <span class="ruby-constant">Invoice</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">john_doe</span>)
<span class="ruby-identifier">invoice</span>.<span class="ruby-identifier">client_name</span>    <span class="ruby-comment"># =&gt; &quot;John Doe&quot;</span>
<span class="ruby-identifier">invoice</span>.<span class="ruby-identifier">client_address</span> <span class="ruby-comment"># =&gt; &quot;Vimmersvej 13&quot;</span>
</pre>

<p>It is also possible to supply a custom prefix.</p>

<pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">Invoice</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">Struct</span>.<span class="ruby-identifier">new</span>(:<span class="ruby-identifier">client</span>)
  <span class="ruby-identifier">delegate</span> :<span class="ruby-identifier">name</span>, :<span class="ruby-identifier">address</span>, <span class="ruby-identifier">to</span><span class="ruby-operator">:</span> :<span class="ruby-identifier">client</span>, <span class="ruby-identifier">prefix</span><span class="ruby-operator">:</span> :<span class="ruby-identifier">customer</span>
<span class="ruby-keyword">end</span>

<span class="ruby-identifier">invoice</span> = <span class="ruby-constant">Invoice</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">john_doe</span>)
<span class="ruby-identifier">invoice</span>.<span class="ruby-identifier">customer_name</span>    <span class="ruby-comment"># =&gt; 'John Doe'</span>
<span class="ruby-identifier">invoice</span>.<span class="ruby-identifier">customer_address</span> <span class="ruby-comment"># =&gt; 'Vimmersvej 13'</span>
</pre>

<p>If the target is <code>nil</code> and does not respond to the delegated
method a <code>NoMethodError</code> is raised, as with any other value.
Sometimes, however, it makes sense to be robust to that situation and that
is the purpose of the <code>:allow_nil</code> option: If the target is not
<code>nil</code>, or it is and responds to the method, everything works as
usual. But if it is <code>nil</code> and does not respond to the delegated
method, <code>nil</code> is returned.</p>

<pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">User</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>
  <span class="ruby-identifier">has_one</span> :<span class="ruby-identifier">profile</span>
  <span class="ruby-identifier">delegate</span> :<span class="ruby-identifier">age</span>, <span class="ruby-identifier">to</span><span class="ruby-operator">:</span> :<span class="ruby-identifier">profile</span>
<span class="ruby-keyword">end</span>

<span class="ruby-constant">User</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">age</span> <span class="ruby-comment"># raises NoMethodError: undefined method `age'</span>
</pre>

<p>But if not having a profile yet is fine and should not be an error
condition:</p>

<pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">User</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>
  <span class="ruby-identifier">has_one</span> :<span class="ruby-identifier">profile</span>
  <span class="ruby-identifier">delegate</span> :<span class="ruby-identifier">age</span>, <span class="ruby-identifier">to</span><span class="ruby-operator">:</span> :<span class="ruby-identifier">profile</span>, <span class="ruby-identifier">allow_nil</span><span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span>

<span class="ruby-constant">User</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">age</span> <span class="ruby-comment"># nil</span>
</pre>

<p>Note that if the target is not <code>nil</code> then the call is attempted
regardless of the <code>:allow_nil</code> option, and thus an exception is
still raised if said object does not respond to the method:</p>

<pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">Foo</span>
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">bar</span>)
    <span class="ruby-ivar">@bar</span> = <span class="ruby-identifier">bar</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">delegate</span> :<span class="ruby-identifier">name</span>, <span class="ruby-identifier">to</span><span class="ruby-operator">:</span> :<span class="ruby-ivar">@bar</span>, <span class="ruby-identifier">allow_nil</span><span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span>

<span class="ruby-constant">Foo</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;Bar&quot;</span>).<span class="ruby-identifier">name</span> <span class="ruby-comment"># raises NoMethodError: undefined method `name'</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-delegate_source')" id="l_method-i-delegate_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/85beb3f6bf3b5a19a09490e25de8676a30cc2640/activesupport/lib/active_support/core_ext/module/delegation.rb#L132" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-delegate_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/module/delegation.rb, line 132</span>
  <span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">delegate</span>(*<span class="ruby-identifier">methods</span>)
    <span class="ruby-identifier">options</span> = <span class="ruby-identifier">methods</span>.<span class="ruby-identifier">pop</span>
    <span class="ruby-keyword">unless</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">to</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:to</span>]
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">'Delegation needs a target. Supply an options hash with a :to key as the last argument (e.g. delegate :hello, to: :greeter).'</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">prefix</span>, <span class="ruby-identifier">allow_nil</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">values_at</span>(<span class="ruby-value">:prefix</span>, <span class="ruby-value">:allow_nil</span>)

    <span class="ruby-keyword">if</span> <span class="ruby-identifier">prefix</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">true</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">to</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^[^a-z_]/</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">'Can only automatically set the delegation prefix when delegating to a method.'</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">method_prefix</span> =        <span class="ruby-keyword">if</span> <span class="ruby-identifier">prefix</span>
        <span class="ruby-node">&quot;#{prefix == true ? to : prefix}_&quot;</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-string">''</span>
      <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span> = <span class="ruby-identifier">caller</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">':'</span>, <span class="ruby-number">2</span>)
    <span class="ruby-identifier">line</span> = <span class="ruby-identifier">line</span>.<span class="ruby-identifier">to_i</span>

    <span class="ruby-identifier">to</span> = <span class="ruby-identifier">to</span>.<span class="ruby-identifier">to_s</span>
    <span class="ruby-identifier">to</span> = <span class="ruby-string">'self.class'</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">to</span> <span class="ruby-operator">==</span> <span class="ruby-string">'class'</span>

    <span class="ruby-identifier">methods</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">method</span><span class="ruby-operator">|</span>
      <span class="ruby-comment"># Attribute writer methods only accept one argument. Makes sure []=</span>
      <span class="ruby-comment"># methods still accept two arguments.</span>
      <span class="ruby-identifier">definition</span> = (<span class="ruby-identifier">method</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/[^\]]=$/</span>) <span class="ruby-operator">?</span> <span class="ruby-string">'arg'</span> <span class="ruby-operator">:</span> <span class="ruby-string">'*args, &amp;block'</span>

      <span class="ruby-comment"># The following generated methods call the target exactly once, storing</span>
      <span class="ruby-comment"># the returned value in a dummy variable.</span>
      <span class="ruby-comment">#</span>
      <span class="ruby-comment"># Reason is twofold: On one hand doing less calls is in general better.</span>
      <span class="ruby-comment"># On the other hand it could be that the target has side-effects,</span>
      <span class="ruby-comment"># whereas conceptualy, from the user point of view, the delegator should</span>
      <span class="ruby-comment"># be doing one call.</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">allow_nil</span>
        <span class="ruby-identifier">module_eval</span>(<span class="ruby-string">&quot;          def #{method_prefix}#{method}(#{definition})        # def customer_name(*args, &amp;block)
            _ = #{to}                                         #   _ = client
            if !_.nil? || nil.respond_to?(:#{method})         #   if !_.nil? || nil.respond_to?(:name)
              _.#{method}(#{definition})                      #     _.name(*args, &amp;block)
            end                                               #   end
          end                                                 # end
&quot;</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span> <span class="ruby-operator">-</span> <span class="ruby-number">3</span>)
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">exception</span> = <span class="ruby-node">%Q(raise &quot;#{self}##{method_prefix}#{method} delegated to #{to}.#{method}, but #{to} is nil: \#{self.inspect}&quot;)</span>

        <span class="ruby-identifier">module_eval</span>(<span class="ruby-string">&quot;          def #{method_prefix}#{method}(#{definition})        # def customer_name(*args, &amp;block)
            _ = #{to}                                         #   _ = client
            _.#{method}(#{definition})                        #   _.name(*args, &amp;block)
          rescue NoMethodError                                # rescue NoMethodError
            if _.nil?                                         #   if _.nil?
              #{exception}                                    #     # add helpful message to the exception
            else                                              #   else
              raise                                           #     raise
            end                                               #   end
          end                                                 # end
&quot;</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span> <span class="ruby-operator">-</span> <span class="ruby-number">2</span>)
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-deprecate">
            
              <b>deprecate</b>(*method_names)
            
            <a href="Module.html#method-i-deprecate" name="method-i-deprecate" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <pre>deprecate :foo
deprecate bar: 'message'
deprecate :foo, :bar, baz: 'warning!', qux: 'gone!'</pre>

<p>You can also use custom deprecator instance:</p>

<pre>deprecate :foo, deprecator: MyLib::Deprecator.new
deprecate :foo, bar: &quot;warning!&quot;, deprecator: MyLib::Deprecator.new</pre>

<p>Custom deprecators must respond to
<code>deprecation_warning(deprecated_method_name, message,
caller_backtrace)</code> method where you can implement your custom warning
behavior.</p>

<pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">MyLib</span><span class="ruby-operator">::</span><span class="ruby-constant">Deprecator</span>
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">deprecation_warning</span>(<span class="ruby-identifier">deprecated_method_name</span>, <span class="ruby-identifier">message</span>, <span class="ruby-identifier">caller_backtrace</span> = <span class="ruby-keyword">nil</span>)
     <span class="ruby-identifier">message</span> = <span class="ruby-node">&quot;#{deprecated_method_name} is deprecated and will be removed from MyLibrary | #{message}&quot;</span>
     <span class="ruby-constant">Kernel</span>.<span class="ruby-identifier">warn</span> <span class="ruby-identifier">message</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-deprecate_source')" id="l_method-i-deprecate_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/e4637530cd181fb03b35ce5fa2e95508f4bc1e1c/activesupport/lib/active_support/core_ext/module/deprecation.rb#L22" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-deprecate_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/module/deprecation.rb, line 22</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">deprecate</span>(*<span class="ruby-identifier">method_names</span>)
  <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">Deprecation</span>.<span class="ruby-identifier">deprecate_methods</span>(<span class="ruby-keyword">self</span>, *<span class="ruby-identifier">method_names</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-local_constant_names">
            
              <b>local_constant_names</b>()
            
            <a href="Module.html#method-i-local_constant_names" name="method-i-local_constant_names" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p><strong>DEPRECATED</strong>: Use <code>local_constants</code> instead.</p>

<p>Returns the names of the constants defined locally as strings.</p>

<pre class="ruby"><span class="ruby-keyword">module</span> <span class="ruby-constant">M</span>
  <span class="ruby-constant">X</span> = <span class="ruby-value">1</span>
<span class="ruby-keyword">end</span>
<span class="ruby-constant">M</span>.<span class="ruby-identifier">local_constant_names</span> <span class="ruby-comment"># =&gt; [&quot;X&quot;]</span>
</pre>

<p>This method is useful for forward compatibility, since Ruby 1.8 returns
constant names as strings, whereas 1.9 returns them as symbols.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-local_constant_names_source')" id="l_method-i-local_constant_names_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/b955939d55b71905fa3e5036149ee4c84943c599/activesupport/lib/active_support/core_ext/module/introspection.rb#L74" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-local_constant_names_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/module/introspection.rb, line 74</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">local_constant_names</span>
  <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">Deprecation</span>.<span class="ruby-identifier">warn</span> <span class="ruby-string">'Module#local_constant_names is deprecated, use Module#local_constants instead'</span>
  <span class="ruby-identifier">local_constants</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">to_s</span> }
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-mattr_accessor">
            
              <b>mattr_accessor</b>(*syms)
            
            <a href="Module.html#method-i-mattr_accessor" name="method-i-mattr_accessor" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Extends the module object with module and instance accessors for class
attributes, just like the native attr* accessors for instance attributes.</p>

<pre class="ruby"><span class="ruby-keyword">module</span> <span class="ruby-constant">AppConfiguration</span>
  <span class="ruby-identifier">mattr_accessor</span> :<span class="ruby-identifier">google_api_key</span>

  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">google_api_key</span> = <span class="ruby-string">&quot;123456789&quot;</span>
<span class="ruby-keyword">end</span>

<span class="ruby-constant">AppConfiguration</span>.<span class="ruby-identifier">google_api_key</span> <span class="ruby-comment"># =&gt; &quot;123456789&quot;</span>
<span class="ruby-constant">AppConfiguration</span>.<span class="ruby-identifier">google_api_key</span> = <span class="ruby-string">&quot;overriding the api key!&quot;</span>
<span class="ruby-constant">AppConfiguration</span>.<span class="ruby-identifier">google_api_key</span> <span class="ruby-comment"># =&gt; &quot;overriding the api key!&quot;</span>
</pre>

<p>To opt out of the instance writer method, pass <code>instance_writer:
false</code>. To opt out of the instance reader method, pass
<code>instance_reader: false</code>. To opt out of both instance methods,
pass <code>instance_accessor: false</code>.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-mattr_accessor_source')" id="l_method-i-mattr_accessor_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/5487daba9736c70b3e2ae868f3e92b24f6620273/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb#L62" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-mattr_accessor_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/module/attribute_accessors.rb, line 62</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">mattr_accessor</span>(*<span class="ruby-identifier">syms</span>)
  <span class="ruby-identifier">mattr_reader</span>(*<span class="ruby-identifier">syms</span>)
  <span class="ruby-identifier">mattr_writer</span>(*<span class="ruby-identifier">syms</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-mattr_reader">
            
              <b>mattr_reader</b>(*syms)
            
            <a href="Module.html#method-i-mattr_reader" name="method-i-mattr_reader" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-mattr_reader_source')" id="l_method-i-mattr_reader_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/5487daba9736c70b3e2ae868f3e92b24f6620273/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb#L4" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-mattr_reader_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/module/attribute_accessors.rb, line 4</span>
  <span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">mattr_reader</span>(*<span class="ruby-identifier">syms</span>)
    <span class="ruby-identifier">options</span> = <span class="ruby-identifier">syms</span>.<span class="ruby-identifier">extract_options!</span>
    <span class="ruby-identifier">syms</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sym</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">NameError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">'invalid attribute name'</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">sym</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^[_A-Za-z]\w*$/</span>
      <span class="ruby-identifier">class_eval</span>(<span class="ruby-string">&quot;        @@#{sym} = nil unless defined? @@#{sym}

        def self.#{sym}
          @@#{sym}
        end
&quot;</span>, <span class="ruby-keyword">__FILE__</span>, <span class="ruby-keyword">__LINE__</span> <span class="ruby-operator">+</span> <span class="ruby-number">1</span>)

      <span class="ruby-keyword">unless</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:instance_reader</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword">false</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:instance_accessor</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword">false</span>
        <span class="ruby-identifier">class_eval</span>(<span class="ruby-string">&quot;          def #{sym}
            @@#{sym}
          end
&quot;</span>, <span class="ruby-keyword">__FILE__</span>, <span class="ruby-keyword">__LINE__</span> <span class="ruby-operator">+</span> <span class="ruby-number">1</span>)
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-mattr_writer">
            
              <b>mattr_writer</b>(*syms)
            
            <a href="Module.html#method-i-mattr_writer" name="method-i-mattr_writer" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-mattr_writer_source')" id="l_method-i-mattr_writer_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/5487daba9736c70b3e2ae868f3e92b24f6620273/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb#L26" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-mattr_writer_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/module/attribute_accessors.rb, line 26</span>
  <span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">mattr_writer</span>(*<span class="ruby-identifier">syms</span>)
    <span class="ruby-identifier">options</span> = <span class="ruby-identifier">syms</span>.<span class="ruby-identifier">extract_options!</span>
    <span class="ruby-identifier">syms</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sym</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">NameError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">'invalid attribute name'</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">sym</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^[_A-Za-z]\w*$/</span>
      <span class="ruby-identifier">class_eval</span>(<span class="ruby-string">&quot;        def self.#{sym}=(obj)
          @@#{sym} = obj
        end
&quot;</span>, <span class="ruby-keyword">__FILE__</span>, <span class="ruby-keyword">__LINE__</span> <span class="ruby-operator">+</span> <span class="ruby-number">1</span>)

      <span class="ruby-keyword">unless</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:instance_writer</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword">false</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:instance_accessor</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword">false</span>
        <span class="ruby-identifier">class_eval</span>(<span class="ruby-string">&quot;          def #{sym}=(obj)
            @@#{sym} = obj
          end
&quot;</span>, <span class="ruby-keyword">__FILE__</span>, <span class="ruby-keyword">__LINE__</span> <span class="ruby-operator">+</span> <span class="ruby-number">1</span>)
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-parent">
            
              <b>parent</b>()
            
            <a href="Module.html#method-i-parent" name="method-i-parent" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns the module which contains this one according to its name.</p>

<pre class="ruby"><span class="ruby-keyword">module</span> <span class="ruby-constant">M</span>
  <span class="ruby-keyword">module</span> <span class="ruby-constant">N</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>
<span class="ruby-constant">X</span> = <span class="ruby-constant">M</span><span class="ruby-operator">::</span><span class="ruby-constant">N</span>

<span class="ruby-constant">M</span><span class="ruby-operator">::</span><span class="ruby-constant">N</span>.<span class="ruby-identifier">parent</span> <span class="ruby-comment"># =&gt; M</span>
<span class="ruby-constant">X</span>.<span class="ruby-identifier">parent</span>    <span class="ruby-comment"># =&gt; M</span>
</pre>

<p>The parent of top-level and anonymous modules is <a
href="Object.html">Object</a>.</p>

<pre class="ruby"><span class="ruby-constant">M</span>.<span class="ruby-identifier">parent</span>          <span class="ruby-comment"># =&gt; Object</span>
<span class="ruby-constant">Module</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">parent</span> <span class="ruby-comment"># =&gt; Object</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-parent_source')" id="l_method-i-parent_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/b955939d55b71905fa3e5036149ee4c84943c599/activesupport/lib/active_support/core_ext/module/introspection.rb#L30" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-parent_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/module/introspection.rb, line 30</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">parent</span>
  <span class="ruby-identifier">parent_name</span> <span class="ruby-operator">?</span> <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">Inflector</span>.<span class="ruby-identifier">constantize</span>(<span class="ruby-identifier">parent_name</span>) <span class="ruby-operator">:</span> <span class="ruby-constant">Object</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-parent_name">
            
              <b>parent_name</b>()
            
            <a href="Module.html#method-i-parent_name" name="method-i-parent_name" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns the name of the module containing this one.</p>

<pre class="ruby"><span class="ruby-constant">M</span><span class="ruby-operator">::</span><span class="ruby-constant">N</span>.<span class="ruby-identifier">parent_name</span> <span class="ruby-comment"># =&gt; &quot;M&quot;</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-parent_name_source')" id="l_method-i-parent_name_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/b955939d55b71905fa3e5036149ee4c84943c599/activesupport/lib/active_support/core_ext/module/introspection.rb#L7" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-parent_name_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/module/introspection.rb, line 7</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">parent_name</span>
  <span class="ruby-keyword">if</span> <span class="ruby-keyword">defined?</span> <span class="ruby-ivar">@parent_name</span>
    <span class="ruby-ivar">@parent_name</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-ivar">@parent_name</span> = <span class="ruby-identifier">name</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/::[^:]+\Z/</span> <span class="ruby-operator">?</span> <span class="ruby-node">$`</span>.<span class="ruby-identifier">freeze</span> <span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-parents">
            
              <b>parents</b>()
            
            <a href="Module.html#method-i-parents" name="method-i-parents" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns all the parents of this module according to its name, ordered from
nested outwards. The receiver is not contained within the result.</p>

<pre class="ruby"><span class="ruby-keyword">module</span> <span class="ruby-constant">M</span>
  <span class="ruby-keyword">module</span> <span class="ruby-constant">N</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>
<span class="ruby-constant">X</span> = <span class="ruby-constant">M</span><span class="ruby-operator">::</span><span class="ruby-constant">N</span>

<span class="ruby-constant">M</span>.<span class="ruby-identifier">parents</span>    <span class="ruby-comment"># =&gt; [Object]</span>
<span class="ruby-constant">M</span><span class="ruby-operator">::</span><span class="ruby-constant">N</span>.<span class="ruby-identifier">parents</span> <span class="ruby-comment"># =&gt; [M, Object]</span>
<span class="ruby-constant">X</span>.<span class="ruby-identifier">parents</span>    <span class="ruby-comment"># =&gt; [M, Object]</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-parents_source')" id="l_method-i-parents_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/b955939d55b71905fa3e5036149ee4c84943c599/activesupport/lib/active_support/core_ext/module/introspection.rb#L46" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-parents_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/module/introspection.rb, line 46</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">parents</span>
  <span class="ruby-identifier">parents</span> = []
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">parent_name</span>
    <span class="ruby-identifier">parts</span> = <span class="ruby-identifier">parent_name</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">'::'</span>)
    <span class="ruby-keyword">until</span> <span class="ruby-identifier">parts</span>.<span class="ruby-identifier">empty?</span>
      <span class="ruby-identifier">parents</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">Inflector</span>.<span class="ruby-identifier">constantize</span>(<span class="ruby-identifier">parts</span> * <span class="ruby-string">'::'</span>)
      <span class="ruby-identifier">parts</span>.<span class="ruby-identifier">pop</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">parents</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Object</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">include?</span> <span class="ruby-constant">Object</span>
  <span class="ruby-identifier">parents</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-qualified_const_defined-3F">
            
              <b>qualified_const_defined?</b>(path, search_parents=true)
            
            <a href="Module.html#method-i-qualified_const_defined-3F" name="method-i-qualified_const_defined-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-qualified_const_defined-3F_source')" id="l_method-i-qualified_const_defined-3F_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/432a65fab2a6c7eb6ff77062e73f7627470f7da7/activesupport/lib/active_support/core_ext/module/qualified_const.rb#L26" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-qualified_const_defined-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/module/qualified_const.rb, line 26</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">qualified_const_defined?</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">search_parents</span>=<span class="ruby-keyword">true</span>)
  <span class="ruby-constant">QualifiedConstUtils</span>.<span class="ruby-identifier">raise_if_absolute</span>(<span class="ruby-identifier">path</span>)

  <span class="ruby-constant">QualifiedConstUtils</span>.<span class="ruby-identifier">names</span>(<span class="ruby-identifier">path</span>).<span class="ruby-identifier">inject</span>(<span class="ruby-keyword">self</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">mod</span>, <span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">const_defined?</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">search_parents</span>)
    <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">name</span>)
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-qualified_const_get">
            
              <b>qualified_const_get</b>(path)
            
            <a href="Module.html#method-i-qualified_const_get" name="method-i-qualified_const_get" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-qualified_const_get_source')" id="l_method-i-qualified_const_get_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/432a65fab2a6c7eb6ff77062e73f7627470f7da7/activesupport/lib/active_support/core_ext/module/qualified_const.rb#L36" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-qualified_const_get_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/module/qualified_const.rb, line 36</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">qualified_const_get</span>(<span class="ruby-identifier">path</span>)
  <span class="ruby-constant">QualifiedConstUtils</span>.<span class="ruby-identifier">raise_if_absolute</span>(<span class="ruby-identifier">path</span>)

  <span class="ruby-constant">QualifiedConstUtils</span>.<span class="ruby-identifier">names</span>(<span class="ruby-identifier">path</span>).<span class="ruby-identifier">inject</span>(<span class="ruby-keyword">self</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">mod</span>, <span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">name</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-qualified_const_set">
            
              <b>qualified_const_set</b>(path, value)
            
            <a href="Module.html#method-i-qualified_const_set" name="method-i-qualified_const_set" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-qualified_const_set_source')" id="l_method-i-qualified_const_set_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/432a65fab2a6c7eb6ff77062e73f7627470f7da7/activesupport/lib/active_support/core_ext/module/qualified_const.rb#L44" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-qualified_const_set_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/module/qualified_const.rb, line 44</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">qualified_const_set</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">value</span>)
  <span class="ruby-constant">QualifiedConstUtils</span>.<span class="ruby-identifier">raise_if_absolute</span>(<span class="ruby-identifier">path</span>)

  <span class="ruby-identifier">const_name</span> = <span class="ruby-identifier">path</span>.<span class="ruby-identifier">demodulize</span>
  <span class="ruby-identifier">mod_name</span> = <span class="ruby-identifier">path</span>.<span class="ruby-identifier">deconstantize</span>
  <span class="ruby-identifier">mod</span> = <span class="ruby-identifier">mod_name</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">?</span> <span class="ruby-keyword">self</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">qualified_const_get</span>(<span class="ruby-identifier">mod_name</span>)
  <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">const_set</span>(<span class="ruby-identifier">const_name</span>, <span class="ruby-identifier">value</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-redefine_method">
            
              <b>redefine_method</b>(method, &amp;block)
            
            <a href="Module.html#method-i-redefine_method" name="method-i-redefine_method" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-redefine_method_source')" id="l_method-i-redefine_method_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/0244c0d8f339385a9b420a0565b17d327bf25b13/activesupport/lib/active_support/core_ext/module/remove_method.rb#L8" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-redefine_method_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/module/remove_method.rb, line 8</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">redefine_method</span>(<span class="ruby-identifier">method</span>, &amp;<span class="ruby-identifier">block</span>)
  <span class="ruby-identifier">remove_possible_method</span>(<span class="ruby-identifier">method</span>)
  <span class="ruby-identifier">define_method</span>(<span class="ruby-identifier">method</span>, &amp;<span class="ruby-identifier">block</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-remove_possible_method">
            
              <b>remove_possible_method</b>(method)
            
            <a href="Module.html#method-i-remove_possible_method" name="method-i-remove_possible_method" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-remove_possible_method_source')" id="l_method-i-remove_possible_method_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/0244c0d8f339385a9b420a0565b17d327bf25b13/activesupport/lib/active_support/core_ext/module/remove_method.rb#L2" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-remove_possible_method_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/module/remove_method.rb, line 2</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">remove_possible_method</span>(<span class="ruby-identifier">method</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">method_defined?</span>(<span class="ruby-identifier">method</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">private_method_defined?</span>(<span class="ruby-identifier">method</span>)
    <span class="ruby-identifier">undef_method</span>(<span class="ruby-identifier">method</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                    </div>

    </div>
  </body>
</html>    